﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public delegate void MessageEvent(CustomMessage message);
public enum MsgType
{
    citie,
    noCitie
}

public class CustomMessage
{
    public CustomMessage(MsgType msgType)
    {
        this.msgType = msgType;
        msgDic = new Dictionary<string, object>();
    }
    public MsgType msgType;
    public Dictionary<string, object> msgDic;

    public object this[string key]
    {
        get
        {
            if (!msgDic.ContainsKey(key))
                return null;
            else
                return msgDic[key];
        }
        set
        {
            if (msgDic.ContainsKey(key))
                msgDic[key] = value;
            else
                msgDic.Add(key, value);
        }
    }

    public void send()
    {
        MessageCenter.instance.Dispatcher(this);
    }
}